# -*- coding: utf-8 -*-            
# @Author : lidong1227
# @Time : 2023/4/30 19:02
from abc import ABCMeta, abstractmethod


class Pay(metaclass = ABCMeta):
    @abstractmethod
    def pay(self, money):
        pass


class AliPay(Pay):

    def __init__(self, isHuaBei = False):
        self.isHuaBei = isHuaBei
    def pay(self, money):
        if self.isHuaBei:
            print(f"使用花呗支付 {money} 元")
        else:
            print(f"使用支付宝支付 {money} 元")

class WechatPay(Pay):
    def pay(self, money):
        print(f"使用微信支付 {money} 元")

class FactoryPay:
    def Pay(self, method):
        if method == "alipay":
            return AliPay()
        elif method == "huabei":
            return AliPay(isHuaBei=True)
        elif method == 'WechatPay':
            return WechatPay()
        else:
            raise TypeError(f"no such payment name {method}" ,method)


f = FactoryPay()
p = f.Pay("huabei")
p.pay(444)